<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!DOCTYPE html>  
<html>  
<head>  
    <title>登录</title>  
    <script src="<%=basePath%>common/jQuery-2.1.3.min.js"></script>  
</head>
<body>
		<form id="form">
			<lable>用户:</lable>	<input name="name" value="123"/>
			<button id="login" type="button">登录</button>	
		</form>
		
</body>  
<script type="text/javascript">
		$("#login").click(function(){
						alert($("#form").serialize());
    						$.ajax({
    						url:"<%=basePath%>user/login",
    						type:'post',
    						data:$("#form").serialize(),
    						success:function(data){
    									if(data.success){
    											if(data.entity){
    												//登录客户端
    												location.href="<%=basePath%>index.jsp";
    											}else{
    												//登录客服端
    												location.href="<%=basePath%>server.jsp";
    											}
    									}else{
    										alert(data.message)
    									}
    									
    							}
    						});
    			});  
</script>
</html>  
